package com.cheejee.oss.controller;

import java.io.IOException;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.cheejee.oss.service.StorageService;

/**
 * @author CARRY
 * @Date 2020年11月6日上午3:01:15
 */
@RestController
@RequestMapping("/storage")
public class StorageController {

	@Resource
	StorageService service;
	
	@GetMapping("/")
	public Object queryStorage(Integer pageNum, Integer pageSize) {
		
		return service.query(pageNum, pageSize);
	}
	
	@PostMapping("/")
	public Object upload(MultipartFile file) throws IOException {
		
		return service.upload(file);
	}
	
	@DeleteMapping("/id")
	public Object delete(Long[] id) throws IOException {
		
		service.delete(id);
		return  "OK";
		
	}
	
}
